def options(opt):
	opt.load('compiler_c')

def configure(conf):
	conf.load('compiler_c')
	conf.env.append_unique('CFLAGS', ['-Wall','-g'])
	conf.find_program('docbook-to-man', mandatory=False, var='D2M')
	conf.find_program('gzip', mandatory=True, var='GZIP')

def build(bld):
	if bld.env.D2M:
		bld(rule='${D2M} ${SRC}', source='elasto_cli.xml')
	else:
		print("Skipping documentation build: "
		      "docbook-to-man binary required")
		# install pre-built man page
	bld(rule='${GZIP} -c ${SRC} > ${TGT}',
	    source='elasto_cli.1',
	    target='elasto_cli.1.gz')
	bld.install_files('${MANDIR}/man1/', ['elasto_cli.1.gz'])
